add_executable(pycall-c main.cpp)

spark_find_library(python311 REQUIRED python-3.11 python-3.11 python-3.11-embed)
target_link_python311(pycall-c)

enable_testing()
set(PYTHON_LIBRARY /usr/lib/x86_64-linux-gnu/libpython3.11.so)
if (EXISTS ${PYTHON_LIBRARY})
    message(STATUS "Found python library: ${PYTHON_LIBRARY}")
    # add_test(NAME TestPytwoway 
    #     COMMAND pycall-c ${PYTHON_LIBRARY}
    #     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
    # )

    add_custom_command(TARGET pycall-c
        POST_BUILD
            COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/script.py ${CMAKE_CURRENT_BINARY_DIR}
            COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_SOURCE_DIR}/script.pyi ${CMAKE_CURRENT_BINARY_DIR}
    )
endif()